package com.wx.gof.pattern.creational.builder;

import lombok.Data;

/**
 * @ClassName ComputerV2
 * @Author wx
 * @Description 计算机V2版本
 * @Date 2018-12-03-22:09
 */
@Data
public class ComputerV2 {
    /**
     * 显示器
     */
    private String display;
    /**
     * 键盘
     */
    private String keyboard;
    /**
     * 处理器
     */
    private String processor;
    /**
     * cpu
     */
    private String  cpu;
    /**
     * 显卡
     */
    private String graphicsCard;

    private ComputerV2(){}

    @Override
    public String toString() {
        return "ComputerV2{" + "display='" + display + '\'' + ", keyboard='" + keyboard + '\'' + ", processor='" + processor + '\'' + ", cpu='" + cpu + '\'' + ", graphicsCard='" + graphicsCard + '\'' + '}';
    }

    /**
     * @Author wx
     * @Description 计算机建造器V2版本
     * @Date 2018-12-03
     */
    public static class ComputerBuilderV2 {
        private  ComputerV2 computerV2 = new ComputerV2();

        public ComputerBuilderV2 setDisplay(String display) {
            computerV2.setDisplay(display);
            return this;
        }

        public ComputerBuilderV2 setKeyboard(String keyboard) {
            computerV2.setKeyboard(keyboard);
            return this;
        }

        public ComputerBuilderV2 setProcessor(String processor) {
            computerV2.setProcessor(processor);
            return this;
        }

        public ComputerBuilderV2 setCpu(String cpu) {
            computerV2.setCpu(cpu);
            return this;
        }

        public ComputerBuilderV2 setGraphicsCard(String graphicsCard) {
            computerV2.setGraphicsCard(graphicsCard);
            return this;
        }

        public ComputerV2 build(){
            return computerV2;
        }
    }

}
